package com.sunxd.vue.application.controller;

import com.sunxd.vue.application.facade.UserFacade;
import com.sunxd.vue.bean.Response;
import com.sunxd.vue.bean.request.UserPageReq;
import com.sunxd.vue.bean.request.UserReq;
import com.sunxd.vue.bean.request.UserUpdateReq;
import com.sunxd.vue.bean.response.UserVo;
import com.sunxd.vue.infrastructure.adapter.db.base.Paging;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author sun.xd
 * @description: description
 * @date 2024/4/2 10:45
 */
@RestController
@RequestMapping(value = "/user")
@RequiredArgsConstructor
public class UserController {

    private final UserFacade userFacade;

    @PostMapping(value = "create")
    public Response<Boolean> create(@RequestBody UserReq req){
        return userFacade.create(req);
    }

    @PostMapping(value = "update")
    public Response<Boolean> update(@RequestBody UserUpdateReq req){
        return userFacade.update(req);
    }


    @PostMapping(value = "page")
    public Response<Paging<UserVo>> page(@RequestBody UserPageReq req){
        return userFacade.page(req);
    }

    @PostMapping(value = "detail")
    public Response<UserVo> detail(@RequestBody UserReq req){
        return userFacade.detail(req);
    }

    @PostMapping(value = "testTran")
    public Response<Boolean> testTran(@RequestBody UserReq req){
        return userFacade.testTran(req);
    }




}
